<extend name="Public:base"/>

<block name="main">
<load href="__JS__/swfupload.js"/>
<div id="yzh-content" class="col-xs-12">
    <div class="main-title">
        <h2>编辑广告</h2>
    </div>

    <form name="myform" id="myform" action="{:U('Wap/editslide')}" method="post" class="form-horizontal">
        <input type="hidden" name="description" value="">
        <input type="hidden" name="content" value="">
        <input type="hidden" name="id" value="{$vo.id}"/>
        <table class="form-table">
        <div class="form-group">
            <label class="control-label col-md-2"><b color="red">*</b>标题</label>
            <div class="col-md-5">
                <input type="text" id="title" name="title" value="{$vo.title}" class="form-control" validate="required:true,cn_username:true, minlength:2, maxlength:20"/>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-md-2">链接</label>
            <div class="col-md-5">
                <input type="text" id="link" name="link" value="{$vo.link}" class="form-control" />
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-md-2">小图</label>
                <div class="col-md-5">
                <div class="small_box"  >
                    <div id="small_aid_box" style="display:none;"></div>


                    <div class="input-group">
                        <input type="text" id="small" name="small" value="{$vo['small']}" class="form-control input-sm" />
                        <span class="input-group-btn">
                            <input type="button" class="btn btn-sm btn-info" value="上传" onclick="javascript:swfupload('pic_uploadfile','small','{:L(uploadfiles)}',1,1,0,10,'jpeg,jpg,png,gif',5,230,'{$yzh_auth}',yesdo,nodo)" />
                        </span>
                    </div>
                </div>
                <div>
                <img src="{if $vo['small']}{$vo['small']}{else}__PUBLIC__/images/pview.gif{/if}" width="150" height="100" id="picview" name="picview">
             </div>
             </div>
        </div>

        <div class="form-group">
            <label class="control-label col-md-2">大图</label>
            <div class="col-md-5">
                <div class="pic_box" >
                    <div id="pic_aid_box" style="display:none;"></div>
                    <div class="input-group">
                        <input type="text" id="pic" name="pic" value="{$vo['pic']}" class="form-control input-sm" />
                        <span class="input-group-btn">
                            <input type="button" class="btn btn-info btn-sm" value="上传" id="upload_pic"/>
                        </span>
                    </div>
                </div>
             <div>
                <img src="{if $vo['pic']}{$vo['pic']}{else}__PUBLIC__/images/pview.gif{/if}" width="150" height="100" id="picview" name="picview"  onclick="showpicbox($('#pic').val());">
             </div>
             (建议尺寸:768px*400px)
            </div>
        </div>

        <div class="form-actions">
            <input type="submit" value="提交" class="btn btn-sm btn-primary"/ >
            <input type="reset" value="取消" class="btn btn-sm btn-primary"/>
        </div>
    </form>
</div>
<script>
    $('#upload_pic').click(function(){
        swfupload('pic_uploadfile','pic','{:L(uploadfiles)}',1,1,0,10,'jpeg,jpg,png,gif',5,230,'{$yzh_auth}',yesdo,nodo);
    });

    $(document).ready(function() {
        $('#myform').ajaxForm({
            success:  complete,  // post-submit callback
            dataType: 'json'
        });
    });

    function complete(data){
        if(data.status==1){
            $.scojs_message('修改成功', $.scojs_message.TYPE_OK);
            setTimeout(function(){
                window.location.href = '{:U("Wap/slide")}';
            },1000);

        }else{
            $.scojs_message(data.info, $.scojs_message.TYPE_ERROR);
        }

    }
</script>

</block>